#ifndef __Render_PlaneRenderable_h__
#define __Render_PlaneRenderable_h__

#include "Render/Renderable.h"
#include "Core/VecMath.h"

#include <vector>

namespace vital {

	//--------------------------------------------------------------------------
	class TPlaneRenderable : public IRenderable {

	public:
		TPlaneRenderable(
			const TVec2 &size,
			const TVec2 &tile,
			size_t division =  1, 
			bool twoSized = false,
			const TMtx4 &rotation = identity4() );

		virtual ~TPlaneRenderable();

		virtual void render();

	private:

		struct Quad{
			size_t idx[4];
		};

		std::vector<TVec3> mVertices;
		std::vector<TVec2> mTexcoords;
		std::vector<Quad> mQuads;
		TVec3 mNormal;
		bool mTwoSided;

		size_t mDivisions;

		void buildPlaneMesh(
			const TVec2 &size,
			const TVec2 &tile,
			size_t division,
			const TMtx4 &rotation);
	};

	//--------------------------------------------------------------------------

}

#endif	// __Render_PlaneRenderable_h__